package com.chentf.reggie.common;

/**
 * @author chentengfei
 * @desc 基于ThreadLocal封装工具,用户保存和获取当前登录id
 * @date 2022-09-10 16:53:06
 */
public class BaseContext {

    private static ThreadLocal<Long> threadLocal = new ThreadLocal<>();

    /***
     * 设置值
     * @author chentengfei
     * @date 2022/9/10 16:55
     * @param id
     */
    public static void setCurrentId(Long id){
        threadLocal.set(id);
    }

    /***
     * 获取值
     * @author chentengfei
     * @date 2022/9/10 16:54
     * @return java.lang.Long
     */
    public static Long getCurrentId(){
        return threadLocal.get();
    }
}
